package com.demo.gulimall.seckill.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;

/**
 * @author Chen Yuan
 * @create 2023-06-01  9:25
 */

@Configuration
public class MyRedissonConfig {

	@Bean
	public RedissonClient redisson() throws IOException{
		// 创建配置
		Config config = new Config();
		config.useSingleServer()
				.setAddress("redis://39.106.206.145:6379")
				.setPassword("cy123");
		// 创建  Redisson 实例
		return Redisson.create(config);
	}
}
